<template>
  <el-form ref="tableConfig" :model="tableConfig" :rules="rules" label-width="80px">
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="表名称" prop="tableName" required>
          <el-input v-model="tableConfig.tableName" :disabled="true"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="表注释" prop="tableComment" required disabled>
          <el-input v-model="tableConfig.tableComment" :disabled="true"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="数据源" prop="dataSourceName" required disabled>
          <el-input v-model="tableConfig.dataSourceName" :disabled="true"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="作者" prop="genAuthor" required>
          <el-input v-model="tableConfig.genAuthor"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="生成方式" prop="genType" required>
          <el-radio-group v-model="tableConfig.genType">
            <el-radio :label="'0'">zip</el-radio>
            <el-radio :label="'1'">文件路径</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="生成路径" prop="genPath">
          <el-input v-model="tableConfig.genPath"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="包路径" prop="genPackage" required>
          <el-input v-model="tableConfig.genPackage"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="类名" prop="genClass" required>
          <el-input v-model="tableConfig.genClass"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="模块名" prop="genModule">
          <el-input v-model="tableConfig.genModule"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="业务名" prop="genBusiness">
          <el-input v-model="tableConfig.genBusiness"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="功能名" prop="genFunction" required>
          <el-input v-model="tableConfig.genFunction"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="备注" prop="remarks">
          <el-input type="textarea" v-model="tableConfig.remarks"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
export default {
  props: {
    tableConfig: {
      type: Object,
      default: null
    }
  },
  data() {
    return {
      rules: {
        tableName: [
          {required: true, trigger: "blur"}
        ],
        tableComment: [
          {required: true, trigger: "blur"}
        ],
        dataSourceName: [
          {required: true, trigger: "blur"}
        ],
        genAuthor: [
          {required: true, message: "请输入作者", trigger: "blur"}
        ],
        genType: [
          {required: true, message: "请选择生成方式", trigger: "blur"}
        ],
        genPath: [
          {required: false, message: "请输入生成路径", trigger: "blur"}
        ],
        genPackage: [
          {required: true, message: "请输入包路径", trigger: "blur"}
        ],
        genModule: [
          {required: false, message: "请输入模块名", trigger: "blur"}
        ],
        genBusiness: [
          {required: false, message: "请输入业务名", trigger: "blur"}
        ],
        genClass: [
          {required: true, message: "请输入类名", trigger: "blur"}
        ],
        genFunction: [
          {required: true, message: "请输入功能名", trigger: "blur"}
        ],
        remarks: [
          {required: false, message: "请输入备注", trigger: "blur"}
        ]
      }
    }
  }
}
</script>
